<?php
namespace app\qianyu\model;
use think\Db;
use think\Model;
use think\Cache;

class Area extends Model
{
    protected $table = 'cbdd_area';
    // 查看首页详情
    public function getListData($level)
    {   
        // $cache = Cache::get('licensePlate');
        // dump($cache);
        // exit;
        // if($cache){
        //     return $cache;
        // }
        $where = [];
        if($level){
            $where['level'] = $level;
        }else{
            $where['level'] = ['gt',$level];
        }
        $data = $this
            ->where('status',1)
            ->where($where)
            // ->order('sort desc')
            ->select();
            if(!$level){
                $data = getTreeDataPhp($data);
            }
        // Cache::set('licensePlate',$data);
        return $data;
    }
}